﻿@{
    ViewBag.Title = "Branch Management";
    Layout = "~/Views/Shared/_Layout.cshtml";

    <style>
        .control-group {
            float: left;
            margin-bottom: 10px;
            width: 45%;
        }

        .control-group60 {
            float: left;
            margin-bottom: 10px;
            width: 60%;
        }

        .control-group30 {
            float: left;
            margin-bottom: 10px;
            width: 30%;
        }

        .control-group90 {
            float: left;
            margin-bottom: 10px;
            width: 90%;
        }

        .field {
            margin-left: 110px;
            position: relative;
        }

        .field90 {
            padding: 5px 15px 0 20px;
            position: relative;
        }

        .label100 {
            width: 100px;
        }

        .section {
            margin-top: 5px;
            margin-left: 10px;
        }
    </style>
    
    <script src="/Scripts/gbh/print.js"></script>
    <script src="/Scripts/gbh/Branch.js"></script>
}

<h2>Branch Management</h2>

<div class="easyui-layout" style="width: 100%; height: 90%">

    <div data-options="region:'north',split:true" style="height: 200px">
        <div>
            <form id="branchform">
                <div class="section">
                    <div class="control-group30">
                        <label class="label-bold label100">
                            Branch No :
                        </label>
                        <span>
                            <input  type='text' name='mbranchno' id='mbranchno' class='input-xxlarge easyui-textbox' />
                            <input id="BranchSearchButton" class="easyui-linkbutton"  value="Search" onclick="BranchSearchPopup();" type="button" />
                        </span>
                    </div>
                    <div class="control-group30">
                        <label class="label-bold label100">
                            Branch Name :
                        </label>
                        <span>
                            <input type='text' name='mprovdesc' id='mprovdesc' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group30">
                        <label class="label-bold label100">
                            NPI Customer :
                        </label>
                        <span>
                            <input data-options="readonly:'true'" type='text' name='mcustno' id='mcustno' class='input-xxlarge easyui-textbox' />
                            <input id="MaterialSearchButton" class="easyui-linkbutton"  value="Search" onclick="CustomerSearchPopup();" type="button" />
                        </span>
                    </div>
                    <div style="clear:both"></div>
                    <div class="control-group60">
                        <label class="label-bold label100">
                            Address 1:
                        </label>
                        <span>
                            <input data-options="readonly:'true'"  style="width: 500px; height:40px;" data-options="multiline:'true' " type='text' name='mstreet' id='mstreet' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group30">
                        <label class="label-bold label100">
                            NPI Customer Name:
                        </label>
                        <span>
                            <input data-options="readonly:'true'" type='text' name='mcustname1' id='mcustname1' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>

                    <div class="control-group30">
                        <label class="label-bold label100">
                            Address 2 :
                        </label>
                        <span class="label100">
                            <input data-options="readonly:'true'" type='text' name='mdistrict' id='mdistrict' class='input-xxlarge easyui-textbox' rows="2" />
                        </span>
                    </div>
                    <div class="control-group30">
                        <label class="label-bold label100">
                            Address 3 :
                        </label>
                        <span>
                            <input data-options="readonly:'true'" type='text' name='mcity' id='mcity' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group30">
                        <label class="label-bold label100">
                            Group :
                        </label>
                        <span>
                            <input type='text' name='mprovtrans' id='mprovtrans' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group30">
                        <label class="label-bold label100">
                            Address 4 :
                        </label>
                        <span>
                            <input data-options="readonly:'true'" type='text' name='mcountrykey' id='mcountrykey' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group30">
                        <label class="label-bold label100">
                            อักษรย่อ(จังหวัด) :
                        </label>
                        <span>
                            <input type='text' name='mprovice' id='mprovice' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>

                    <div class="control-group30">
                        <label class="label-bold label100">
                            Transport Zone :
                        </label>
                        <span>
                            <input type='text' name='mprovtran_grp' id='mprovtran_grp' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                </div>
            </form>
        </div>
        <div style="clear:left" text-align: left; padding: 5px">
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="Save(true)">Save</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">Cancel & Clear</a>
            @*<a href="javascript:void(0)" class="easyui-linkbutton" onclick="Save(true)">Display SKU</a>*@
        </div>
    </div>
    <div data-options="region:'center',iconCls:'icon-ok'">
        <div class="easyui-layout" data-options="fit:true">
            <div data-options="region:'east',split:true" title="ค้นหาสินค้าใน branch" style="width: 250px;">
                <div style="margin: 20px 0;"></div>
                MatNO :
                <input id="Matnofilter" class="easyui-searchbox" data-options="prompt:'Enter Matarial No.',searcher:doSearch" />
                Barcode NO :
                <input id="Barcodefilter" class="easyui-searchbox" data-options="prompt:'Enter Matarial No.',searcher:doSearchBranch" />
                <div style="margin-top: 10px;">
                    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width: 100px" onclick="filterByMatNo();">Advance</a>

                    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" style="width: 80px" onclick="clearfilter();">Clear</a>
                </div>
                <br />
                <div>
                    <b>Material <label id="matnumber"></label> SKU</b> 
                </div>
                <br />
                <div>
                    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" style="width: 100px" onclick="CreateFormPage('รายการสินค้า', jQuery('#MatAll'));">Print</a>

                    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" style="width: 80px" onclick="exportMatInBranch();">Export</a>
                </div>
            </div>
            <div data-options="region:'center',title:'รายการสินค้า ใน branch',iconCls:'icon-ok'">
                <table id="MatAll" title="" class="easyui-datagrid" style="width: 100%; height: 400px;"
                    rownumbers="true" toolbar="#toolbar" fitcolumns="true" singleselect="true">
                    <thead>
                        <tr>
                            <th field="meancode" width="100" align="center">NPI Barcode
                            </th>
                            <th field="mmatno" editor="text" width="150" align="center">Material
                            </th>
                            <th field="mmatthai" editor="text" width="100%" align="center">Descriptioon
                            </th>
                        </tr>
                    </thead>
                </table>

            </div>
        </div>


    </div>

</div>

<div id="customerSearch" class="easyui-dialog" style="width: 650px; height: 550px; padding: 10px 20px"
            closed="true" buttons="#dlgNonHr-buttons">
            <div>
                <label>
                    ชื่อลูกค้า</label>
                <input id="searchCustomerNameThai" value="สยามโกลบอลเฮ้าส์">
                <div>
                     <a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="searchCustomer()">ค้นหา</a>
                </div>
            </div>
            <table id="dlgCustomerSearch" title="ค้นหาลูกค้า" class="easyui-datagrid"
                style="width: 600px; height: 500px;"
                rownumbers="true" singleselect="true">
                <thead>
                    <tr>
                        <th field="mcustno" width="150" align="center" sortable="true">รหัสลูกค้า
                        </th>
                        <th field="mcustname1" width="-00" align="center" sortable="true">ชื่อลูกค้า
                        </th>
                       
                    </tr>
                </thead>
            </table>

</div>
        <div id="dlgNonHr-buttons">
            <a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="selectCustomer();">Select</a>
            <a href="#" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:jQuery('#customerSearch').dialog('close');">Cancel</a>
        </div>

<div id="branchSearch" class="easyui-dialog" style="width: 650px; height: 550px; padding: 10px 20px"
            closed="true" buttons="#dlgNonHrBranch-buttons">
            <div>
                 <label>
                    รหัส Branch</label>
                <input id="branchNo" >
              
                <label>
                    ชื่อ Branch</label>
                <input id="branchName" >
                <div>
                     <a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="searchBranch()">ค้นหา</a>
                </div>
            </div>
            <table id="dlgBranchSearch" title="ค้นหา Branch" class="easyui-datagrid"
                style="width: 600px; height: 500px;"
                rownumbers="true" singleselect="true">
                <thead>
                    <tr>
                        <th field="mbranchno" width="150" align="center" sortable="true">รหัส Branch
                        </th>
                        <th field="mprovdesc" width="-00" align="center" sortable="true">ชื่อ Branch
                        </th>
                       
                    </tr>
                </thead>
            </table>

</div>
        <div id="dlgNonHrBranch-buttons">
            <a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="selectBranch();">Select</a>
            <a href="#" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:jQuery('#branchSearch').dialog('close');">Cancel</a>
        </div>